--[[/**
-- * 
 * 伤害的[0]%转化为生命值
-- */]]

---@class BuffEffect415100 : BaseBuffEffect
BuffEffect415100 = ClientFight.CreateClass("BuffEffect415100", ClientFight.BaseBuffEffect)
local t = BuffEffect415100

---@param fight Fight
---@param buff FighterBuff
function t:action(fight, buff, ...)
    local parameters = {...};

    if (table.getn(parameters) < 3) then
        return ClientFight.BaseBuffEffect.action(self, fight, buff, ...);

    end
    if ( not parameters[3]) then
        return ClientFight.BaseBuffEffect.action(self, fight, buff, ...);

    end
    local fightResult =  parameters[3];
    if (not AttackUtils.isDamage(fightResult.state)) then
        return ClientFight.BaseBuffEffect.action(self, fight, buff, ...);
    end

    local effectVal = buff.buffBean.f_BuffEffectValue;
    local damage = fightResult.damage;
    fightResult.damage = 0;
    fightResult.state = DamageResultTypeEnum.NONE;

    local addHp = (damage* Utils.toRatio(effectVal[1]));
    DamageManager.setFighterHp(fight, buff.source, buff.source, nil, DamageResultTypeEnum.HEAL,addHp,
    buff.source.hp + addHp, true, false, true);
    SkillRoleMgr.savePathFile( "[" .. fight.frame .. "][EFFECT]Fighter " .. buff.source.fighterId .. " Buff:"
    .. buff.modelId .. " 伤害转换生命值:"..addHp);
    return ClientFight.BaseBuffEffect.action(self, fight, buff, ...);
end

t.New()